package com.ie.api.center.data.fegin;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ie.api.center.data.hystrix.ControlInfoClientHystrix;
import com.ie.api.center.data.hystrix.RealDataClientHystrix;
import com.xj.common.bean.R;
import com.xj.common.bean.constant.Common;
import com.xj.common.bean.point.PointValue;
import com.xj.common.model.ControlInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;


//定义一个feign接口，通过@FeignClient("服务名")，来指定调用哪个服务
@FeignClient(value = Common.Service.IE_DATA_SERVICE_NAME,fallback= ControlInfoClientHystrix.class)
public interface ControlInfoClient {

	/**
	 * 发送控制命令
	 * @param jsonParam
	 * @return
	 */
	@RequestMapping(value = Common.Service.IE_CTRL+Common.Service.IE_CTRL_SEND, method = RequestMethod.POST)
	R<String>  sendCtl(@RequestBody JSONObject jsonParam);


	/**
	 * 获取控制结果
	 * @param jsonParam
	 * @return
	 */
	@RequestMapping(value = Common.Service.IE_CTRL+Common.Service.IE_CTRL_GETRESULT, method = RequestMethod.POST)
	R<ControlInfo>   handleGetCtlResult(@RequestBody JSONObject jsonParam);

	/**
	 * 根据条件，获取控制历史数据
	 */
	@RequestMapping(value = Common.Service.IE_CTRL+Common.Service.IE_CTRL_GETLATESTCTLINFO, method = RequestMethod.POST)
	R<Page<ControlInfo>>   handleGetCtllist(@RequestBody JSONObject jsonParam);
	/**根据设备id获取最近一次控制历史数据
	 *
	 */
	@RequestMapping(value = Common.Service.IE_CTRL+Common.Service.IE_CTRL_LIST, method = RequestMethod.POST)
	R<List<ControlInfo>>   handleGetLatestCtllistByDeviceID(@RequestBody JSONObject jsonParam);

}






